<template>
	<view class="content">
		<top-userinfo :userusername="userusername" ref="topuserinfo" :parentData="false"></top-userinfo>
		<view class="about">
			<rich-text :nodes="privacy_txt" class="text"></rich-text>
		</view>
	</view>
</template>

<script>
	import {getprivacy_agreement} from "@/api/apiinfo";
	import topuserinfo from './../../components/top_userinfo.vue';
	export default {
		components:{
			"top-userinfo":topuserinfo
		},
		data() {
			return {
				privacy_txt:'',
				userusername:''
			}
		},
		// mounted() { ////////////////// uni组件样式重定义
		// 	var str = document.getElementsByClassName("uni-list-chat__header-image");
		// 	Array.prototype.forEach.call(str, function(headerImage){
		// 		headerImage.style.margin = "0";
		// 	});
		// 	var str = document.getElementsByClassName("uni-list-chat__content-title");
		// 	Array.prototype.forEach.call(str, function(contentTitle){
		// 		contentTitle.style.color = "#fff";
		// 	});
		// 	var str = document.getElementsByClassName("uni-list-chat__content-note");
		// 	Array.prototype.forEach.call(str, function(contentNote){
		// 		contentNote.style.color = "#fff";
		// 	});
		// },
		onLoad() {
			// let user_name = localStorage.getItem('username')
			// if(user_name == '' || user_name == null){
			// 	user_name = localStorage.getItem('nickname')
			// }
			// this.userusername = user_name;
			this.$nextTick(() => {
			    this.$refs.topuserinfo.getuserreload()
			});
			this.getprivacy_agreementinfo()//用户隐私协议
		},
		methods: {
			getprivacy_agreementinfo(){ //用户隐私协议
				getprivacy_agreement().then((res) => {
					console.log("用户隐私协议接口返回数据：")
					console.log(JSON.stringify(res));
					this.privacy_txt = res.data.content
				}).catch(err => {
					// console.log(JSON.stringify(err))
					uni.showModal({
						title: '提示',
						content: '用户隐私协议报错：'+err.errMsg,
						showCancel: false,
						success: function (res) {
							if (res.confirm) {
								// uni.switchTab({ //内部页面跳转方式
								// 	url: '/pages/shop/shop'
								// })
							} 
						}
					});
				})
			},
		}
	}
</script>


<style lang="scss">
	.content{
		position: relative;
		.about{
			padding: 30rpx;
		}
	}
	page{
		background-color: #fff;
	}
</style>
